#include "Pusher.h"
#include "ActivateAbility.h"

Pusher::Pusher(): activateAbility(0)
{
	// Setup abilities
	activateAbility = new ActivateAbility(this);
	blockMoveAbility = new BlockMoveAbility();


	AddAbility(activateAbility);
	AddAbility(blockMoveAbility);

	// Setup behaviour
	behavior.SetActivator(this);
}

Pusher::~Pusher()
{
	if (activateAbility)
	{
		delete activateAbility;
		activateAbility = 0;
	}

	if (blockMoveAbility)
	{
		delete blockMoveAbility;
		blockMoveAbility = 0;
	}
}

void Pusher::SetPushDirection(const Direction& direction)
{
	pushDirection = direction;
	behavior.SetPushDirection(direction);
	blockMoveAbility->SetBlockDirection(direction.Opposed());
}

void Pusher::Activate()
{
	printf("Pusher activated\n");
}

StepCalculator* Pusher::GetActivationBehavior()
{
	return &behavior;
}


void Pusher::MoveTo(unsigned int cellX, unsigned int cellY)
{
	SetPosition(cellX, cellY);
}